{extend name="/fool" /}
{block name="css"}
<link rel="stylesheet" href="/css/admin/loan.css">
<style>
    #page{
        position: relative;
        display: inline-block;
        left:30%;
        margin-left:-50px;
        padding:50px 0;
    }
    .blue{
        color:#409EFF;
    }
    .red{
        color: #F56C6C;
    }
</style>
{/block}
{block name="menu_content"}
<div id="one">
    <form class="layui-form" action="" method="post">
        <ul>
            <li>
                <div>
                    <div class="layui-input-inline">
                        <div class="layui-input-inline">
                            <select name="status">
                                //'1'后台减少操作, '2'后台增加操作, '3'用户兑换
                                <option value="">状态</option>
                                <option value="10">后台增加操作</option>
                                <option value="20">后台减少操作</option>
                                <option value="30">用户兑换</option>
                            </select>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="time" class="layui-input" id="test1" placeholder="开始时间 至 结束时间">
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <div class="layui-input-inline">
                    <input type="text" name="name" autocomplete="off" class="layui-input" placeholder="用户">
                </div>
                <button type="Submit" class="layui-btn">筛选</button>
            </li>
        </ul>
    </form>
</div>
<div>
    <table>
        <tr>
            <th>时间</th>
            <th>用户</th>
            <th>类型</th>
            <th>额度（元）</th>
        </tr>
        {if isset($list)}
        {foreach $list as $v}
        <tr class="list">
            <td>{$v.create_time}</td>
            <td>{$v.name}</td>
            <td>
                {if $v.status == 10}
                后台增加操作({$v.czuser})
                {elseif $v.status == 20}
                后台减少操作({$v.czuser})
                {elseif $v.status == 30}
                用户兑换
                {elseif $v.status == 40}
                {/if}
            </td>
            <td>

                {if $v.status == 10}
               <span class="blue">+{$v.money}</span>
                {elseif $v.status == 20}
                <span class="red">-{$v.money}</span>
                {elseif $v.status == 30}
               <span class="blue">+{$v.money}</span>
                {/if}
                </td>
        </tr>
        {/foreach}
        {/if}
    </table>
    <div id="page">
        {if isset($list)}
        {$page|raw}
        {/if}
    </div>
</div>
<script>
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#test1'
            ,type: 'month'
            ,range: '至'
            ,format: 'yyyy-MM'
        });
    });
    $(".viewbu").click(function(){
        var id = $(this).attr('sid');
        var url = "{:url('view',['id'=>'6','index'=>'1'])}" + '&view=' + '3' + '&battery_order=' + id;
        console.log(url);
        location.href = url;
    })
    layui.use('laypage', function(){
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'page'
            ,count: "{$count}"
            ,curr:"{$curl}"
            ,last:"{$groups}"
            ,limit:"{$limit}"
            ,layout: ['count', 'prev', 'page', 'next', 'limit', 'refresh', 'skip']
            ,jump: function(obj,first){
                console.log(obj)
                if(!first){
                    var url = "{:url('index',['id'=>5,'index'=>0])}" + '&page=' + obj.curr + '&limit=' + obj.limit + '&curr=' + obj.curr;
                    location.href = url;
                }
            }
        });
    });
</script>
{/block}